/**
 * @description: sessionStorage Value
 * @param {type: String}
 * @return: [Object,String,null]
 */
function getSessionStorage(key) {
    let storageData = sessionStorage.getItem(key);
    if (storageData) {
        let storage;
        try {
            storage = JSON.parse(storageData);
        }
        catch (err) {
            storage = storageData;
        }
        return storage;
    }
    return storageData;
}
/**
 * @description: sessionStorage set Value
 * @param {[key,data]}
 * @return:void
 */
function setSessionStorage(key, data) {
    typeof data === "string" ? sessionStorage.setItem(key, data) : sessionStorage.setItem(key, JSON.stringify(data));
}
/**
 * @description: remove sessionStorage key
 * @param { arguments }
 * @return: [Array,undefined]
 */
function removeSessionStorageKey(...args) {
    let errArgs = [];
    args.forEach((item) => {
        typeof item === "string" ? sessionStorage.removeItem(item) : errArgs.push(item);
    });
    return errArgs.length ? { errMsg: "error param", errKey: errArgs } : undefined;
}

export { getSessionStorage, removeSessionStorageKey, setSessionStorage };
